日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

安装好机器学习环境的虚拟机_虚拟环境之外的数据科学是弄乱机器的好方法

發(fā)布時(shí)間:2023/12/15 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安装好机器学习环境的虚拟机_虚拟环境之外的数据科学是弄乱机器的好方法 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

安裝好機(jī)器學(xué)習(xí)環(huán)境的虛擬機(jī)

While doing startup data science, I’ve seen machines get into unhelpful states due to installing packages globally.

在進(jìn)行啟動(dòng)數(shù)據(jù)科學(xué)時(shí),我已經(jīng)看到由于在全球范圍內(nèi)安裝軟件包,機(jī)器陷入了無(wú)益的狀態(tài)。

在一種情況下, (In one situation,)

  • The latest version of Spacy was being used for local development.

    Spacy的最新版本已用于本地開(kāi)發(fā)。
  • An older version was building models (behind the scenes) on a “no-code” vendor server.

    一個(gè)較舊的版本正在“無(wú)代碼”供應(yīng)商服務(wù)器上(在幕后)構(gòu)建模型。
  • And yet another version was running on an AWS server.

    而且另一個(gè)版本正在AWS服務(wù)器上運(yùn)行。

Not only were there compatibility issues between each, but without a virtual environment, uninstalling and re-installing different versions at different times locally was required to make it work.

不僅每個(gè)組件之間都存在兼容性問(wèn)題,而且在沒(méi)有虛擬環(huán)境的情況下,還需要在本地不同時(shí)間卸載和重新安裝不同的版本才能使其正常工作。

Additionally, installing everything globally makes it tough to know which versions should actually be installed on the production server when it comes time to deploy.

此外,在全球范圍內(nèi)安裝所有內(nèi)容將使您很難在部署時(shí)就知道應(yīng)在生產(chǎn)服務(wù)器上實(shí)際安裝哪些版本。

避免這種廢話很容易。 (It’s easy to avoid this nonsense.)

Just give each project it’s own environment.

只需為每個(gè)項(xiàng)目提供自己的環(huán)境即可。

You have a few options here. But if you’re getting started, use pip and virtualenv.

您在這里有一些選擇。 但是,如果要開(kāi)始使用,請(qǐng)使用pip和virtualenv 。

Now I’ll walk you through setting up a jupyter notebook in a virtual environment.

現(xiàn)在,我將指導(dǎo)您在虛擬環(huán)境中設(shè)置Jupyter筆記本。

(Code)

Ensure you have python installed.

確保您已安裝python。

$ python3 --version

Should return something like Python 3.8.5.

應(yīng)該返回類似 Python 3.8.5 。

If not, then install python3.

如果沒(méi)有,請(qǐng)安裝python3。

$ brew install python

Get python’s location

獲取python的位置

$ which python3

Should return something like /usr/local/bin/python3 .

應(yīng)該返回類似 /usr/local/bin/python3 。

Create a virtual environment

創(chuàng)建一個(gè)虛擬環(huán)境

$ virtualenv --python=/usr/bin/python3 venv

Point this to the location of python from the previous step.

將此指向上一步中python的位置。

Activate the environment you just created

激活剛剛創(chuàng)建的環(huán)境

$ source venv/bin/activate

Install jupyter

安裝jupyter

$ pip3 install notebook

This allows creating notebooks.

這樣可以創(chuàng)建筆記本。

Good progress, but you’re not done yet! If you install packages with pip now, your notebook will still silently use globally installed packages. Instead of what you’ve installed in this new environment.

進(jìn)展不錯(cuò),但您還沒(méi)有完成! 如果您現(xiàn)在使用pip安裝軟件包,則筆記本計(jì)算機(jī)仍將靜默使用全局安裝的軟件包。 而不是您在此新環(huán)境中安裝的內(nèi)容。

Create the jupyter kernel

創(chuàng)建jupyter內(nèi)核

$ pip3 install ipykernel

Point it to the virtual environment

將其指向虛擬環(huán)境

$ python3 -m ipykernel install --user --name=venv

Now you can open up Jupyter

現(xiàn)在您可以打開(kāi)Jupyter

$ jupyter notebook

Click on “New” in the top right, and select your virtual environment.

單擊右上角的“新建”,然后選擇您的虛擬環(huán)境。

Your notebook will now use the packages installed in this new environment.

您的筆記本現(xiàn)在將使用在此新環(huán)境中安裝的軟件包。

Beautiful!

美麗!

結(jié)論 (Conclusion)

I hope you found this useful. And that it saves others from a similar fate to the nightmare above.

希望您覺(jué)得這有用。 這樣可以使其他人擺脫與上述噩夢(mèng)類似的命運(yùn)。

After all, it’s so easy, and comes with the added benefit of allowing you to share exact versions with others on your team.

畢竟,它是如此簡(jiǎn)單,并且具有允許您與團(tuán)隊(duì)中的其他人共享確切版本的附加好處。

Let me know if you have any questions regarding package management, and I’ll do my best to help out!

如果您對(duì)包裹管理有任何疑問(wèn),請(qǐng)告訴我,我會(huì)盡力幫助您!

翻譯自: https://towardsdatascience.com/data-science-outside-a-virtual-environment-is-a-great-way-to-mess-up-your-machine-770d72f77e66

安裝好機(jī)器學(xué)習(xí)環(huán)境的虛擬機(jī)

總結(jié)

以上是生活随笔為你收集整理的安装好机器学习环境的虚拟机_虚拟环境之外的数据科学是弄乱机器的好方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。