Python 软件包不能在现实生活中使用,只能在虚拟环境中使用
Python package won't work in real-life, only in virtual env
背景
我有一个包裹,stacksearch which should work, at least in my virtual environment. (Here's the testpypi。)
(venv) RealName@theXliners-Mac stacksearch % python setup.py sdist bdist_wheel
running sdist
running egg_info
creating stacksearch.egg-info
writing stacksearch.egg-info/PKG-INFO
writing dependency_links to stacksearch.egg-info/dependency_links.txt
writing requirements to stacksearch.egg-info/requires.txt
writing top-level names to stacksearch.egg-info/top_level.txt
writing manifest file 'stacksearch.egg-info/SOURCES.txt'
reading manifest file 'stacksearch.egg-info/SOURCES.txt'
writing manifest file 'stacksearch.egg-info/SOURCES.txt'
running check
warning: Check: missing required meta-data: url
creating stacksearch-1.2.1.dev6
creating stacksearch-1.2.1.dev6/scripts
creating stacksearch-1.2.1.dev6/stacksearch.egg-info
copying files to stacksearch-1.2.1.dev6...
copying README.md -> stacksearch-1.2.1.dev6
copying setup.py -> stacksearch-1.2.1.dev6
copying scripts/stacksearch -> stacksearch-1.2.1.dev6/scripts
copying stacksearch.egg-info/PKG-INFO -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/SOURCES.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/dependency_links.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/requires.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/top_level.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
Writing stacksearch-1.2.1.dev6/setup.cfg
creating dist
Creating tar archive
removing 'stacksearch-1.2.1.dev6' (and everything under it)
running bdist_wheel
running build
running build_scripts
creating build
creating build/scripts-3.8
copying and adjusting scripts/stacksearch -> build/scripts-3.8
changing mode of build/scripts-3.8/stacksearch from 644 to 755
installing to build/bdist.macosx-10.9-x86_64/wheel
running install
running install_egg_info
Copying stacksearch.egg-info to build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6-py3.8.egg-info
running install_scripts
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts
copying build/scripts-3.8/stacksearch -> build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts
changing mode of build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts/stacksearch to 755
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.dist-info/WHEEL
creating 'dist/stacksearch-1.2.1.dev6-py3-none-any.whl' and adding 'build/bdist.macosx-10.9-x86_64/wheel' to it
adding 'stacksearch-1.2.1.dev6.data/scripts/stacksearch'
adding 'stacksearch-1.2.1.dev6.dist-info/LICENSE'
adding 'stacksearch-1.2.1.dev6.dist-info/METADATA'
adding 'stacksearch-1.2.1.dev6.dist-info/WHEEL'
adding 'stacksearch-1.2.1.dev6.dist-info/top_level.txt'
adding 'stacksearch-1.2.1.dev6.dist-info/RECORD'
removing build/bdist.macosx-10.9-x86_64/wheel
(venv) RealName@theXliners-Mac stacksearch %
所以,为了模拟安装,我 运行 pip install -e .
(在我的虚拟环境中)在我的上层 stacksearch
文件夹中。
(venv) RealName@theXliners-Mac stacksearch % pip install -e .
Obtaining file:///Users/RealName/projects/stacksearch
Requirement already satisfied: requests in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (2.24.0)
Requirement already satisfied: bs4 in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (0.0.1)
Requirement already satisfied: blessings in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (1.7)
Requirement already satisfied: lxml in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (4.5.2)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1
.2.1.dev6) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2020.6.20
)
Requirement already satisfied: idna<3,>=2.5 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (3.0.4)
Requirement already satisfied: beautifulsoup4 in /Users/bryanhu/venv/lib/python3.8/site-packages (from bs4->stacksearch==1.2.1.dev6) (4.9.1)
Requirement already satisfied: six in /Users/bryanhu/venv/lib/python3.8/site-packages (from blessings->stacksearch==1.2.1.dev6) (1.15.0)
Requirement already satisfied: soupsieve>1.2 in /Users/bryanhu/venv/lib/python3.8/site-packages (from beautifulsoup4->bs4->stacksearch==1.2.1.dev6) (2.0
.1)
Installing collected packages: stacksearch
Attempting uninstall: stacksearch
Found existing installation: stacksearch 1.2.1.dev6
Uninstalling stacksearch-1.2.1.dev6:
Successfully uninstalled stacksearch-1.2.1.dev6
Running setup.py develop for stacksearch
Successfully installed stacksearch
(venv) RealName@theXliners-Mac stacksearch %
然后我运行stacksearch
(命令):
(venv) RealName@theXliners-Mac stacksearch % stacksearch
usage: StackSearch [-h] [-j] [-o [OUTPUT]] [-s] [--sites SITES [SITES ...]] [-v] [query [query ...]]
For searching Whosebug and getting results that you can use.
There are many other libraries/modules available that do the same
thing. The reason you should use this is because this returns results that you can
use. If ran from the command line, it'll return human readable results. If ran from
another python script, it'll return some parsable JSON. Assuming you are utilizing
this script's wonderful functions and objects.
positional arguments:
query The query to search.
optional arguments:
-h, --help show this help message and exit
-j, --json, --raw-data, -r, --raw
For outputting JSON data that you can use.
-o [OUTPUT], --output [OUTPUT]
The output file.
-s, --silent Don't print the progress.
--sites SITES [SITES ...]
The StackExchange sites to search.
-v, -V, --version Print the version number and exit.
Judge a man by his questions rather than by his answers" - Voltaire
(venv) RealName@theXliners-Mac stacksearch %
有效! (要查看文件中的内容,请查看 GitHub repo)
但遗憾的是,事实并非如此:它不适用于我从 testpypi 获得的那个。
(venv) RealName@theXliners-Mac ~ % pip install -i https://test.pypi.org/simple/ stacksearch==1.2.1.dev6; stacksearch
Looking in indexes: https://test.pypi.org/simple/
Collecting stacksearch==1.2.1.dev6
Downloading https://test-files.pythonhosted.org/packages/a4/09/5040ea9750192d64ccb634e022967793759592a47637731a845dbb2ab636/stacksearch-1.2.1.dev6-py3
-none-any.whl (4.4 kB)
Requirement already satisfied: bs4 in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (0.0.1)
Requirement already satisfied: blessings in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (1.7)
Requirement already satisfied: lxml in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (4.5.2)
Requirement already satisfied: requests in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (2.24.0)
Requirement already satisfied: beautifulsoup4 in ./venv/lib/python3.8/site-packages (from bs4->stacksearch==1.2.1.dev6) (4.9.1)
Requirement already satisfied: six in ./venv/lib/python3.8/site-packages (from blessings->stacksearch==1.2.1.dev6) (1.15.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (1
.25.10)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2.10)
Requirement already satisfied: soupsieve>1.2 in ./venv/lib/python3.8/site-packages (from beautifulsoup4->bs4->stacksearch==1.2.1.dev6) (2.0.1)
Installing collected packages: stacksearch
Successfully installed stacksearch-1.2.1.dev6
Traceback (most recent call last):
File "/Users/bryanhu/venv/bin/stacksearch", line 156, in <module>
main(sys.argv[1:])
File "/Users/bryanhu/venv/bin/stacksearch", line 25, in main
from stacksearch import __version__
ModuleNotFoundError: No module named 'stacksearch'
那我测试一下:
(venv) RealName@theXliners-Mac ~ % python
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import stacksearch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'stacksearch'
>>>
我的问题
为什么当我执行 pip install -e .
时,我可以安装软件包,但如果我从 PyPi 安装它,它只会安装二进制文件?
这可能是您问题的答案。将其发布为答案允许我使用我需要的 space 和格式。
基本问题是您没有在 dist 文件中包含 stacksearch
文件夹。
我发现的一种方法是从 pypi.test 下载您的 tar 球。您可以看到文件夹中的内容,并且只有脚本。另一种方法是查看 pip install -e .
命令的结果。你可以在这里看到它:
copying README.md -> stacksearch-1.2.1.dev6
copying setup.py -> stacksearch-1.2.1.dev6
copying scripts/stacksearch -> stacksearch-1.2.1.dev6/scripts
copying stacksearch.egg-info/PKG-INFO -> stacksearch-1.2.1.dev6/stacksearch.egg-info
它只是复制脚本文件夹
您可以 run commands directly from setup.py 通过 python -m setup.py <some command>
看看正在构建什么。
可能的解决方案
可能是 find_packages
没有找到您认为的所有内容。尝试将该函数导入解释器并 运行 它。这是我自己的存储库中的结果:
find_packages()
Out[9]:
['dicetables',
'tests',
'time_trials',
'dicetables.eventsbases',
'dicetables.factory',
'dicetables.tools',
'tests.eventsbases',
'tests.factory',
'tests.tools']
find_packages(include='dicetables')
Out[10]: []
find_packages(include=['dicetables'])
Out[11]: ['dicetables']
不一定是您所期望的。因此,尝试使用 find_packages
以及当您 pip install -e .
时 确切地 被复制的内容
p.s。您没有在本地目录中发现任何问题,因为您的脚本可以从已经存在的文件夹中导入。如果你已经移动到不同的目录,它应该会失败。
背景
我有一个包裹,stacksearch which should work, at least in my virtual environment. (Here's the testpypi。)
(venv) RealName@theXliners-Mac stacksearch % python setup.py sdist bdist_wheel
running sdist
running egg_info
creating stacksearch.egg-info
writing stacksearch.egg-info/PKG-INFO
writing dependency_links to stacksearch.egg-info/dependency_links.txt
writing requirements to stacksearch.egg-info/requires.txt
writing top-level names to stacksearch.egg-info/top_level.txt
writing manifest file 'stacksearch.egg-info/SOURCES.txt'
reading manifest file 'stacksearch.egg-info/SOURCES.txt'
writing manifest file 'stacksearch.egg-info/SOURCES.txt'
running check
warning: Check: missing required meta-data: url
creating stacksearch-1.2.1.dev6
creating stacksearch-1.2.1.dev6/scripts
creating stacksearch-1.2.1.dev6/stacksearch.egg-info
copying files to stacksearch-1.2.1.dev6...
copying README.md -> stacksearch-1.2.1.dev6
copying setup.py -> stacksearch-1.2.1.dev6
copying scripts/stacksearch -> stacksearch-1.2.1.dev6/scripts
copying stacksearch.egg-info/PKG-INFO -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/SOURCES.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/dependency_links.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/requires.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
copying stacksearch.egg-info/top_level.txt -> stacksearch-1.2.1.dev6/stacksearch.egg-info
Writing stacksearch-1.2.1.dev6/setup.cfg
creating dist
Creating tar archive
removing 'stacksearch-1.2.1.dev6' (and everything under it)
running bdist_wheel
running build
running build_scripts
creating build
creating build/scripts-3.8
copying and adjusting scripts/stacksearch -> build/scripts-3.8
changing mode of build/scripts-3.8/stacksearch from 644 to 755
installing to build/bdist.macosx-10.9-x86_64/wheel
running install
running install_egg_info
Copying stacksearch.egg-info to build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6-py3.8.egg-info
running install_scripts
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts
copying build/scripts-3.8/stacksearch -> build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts
changing mode of build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.data/scripts/stacksearch to 755
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-10.9-x86_64/wheel/stacksearch-1.2.1.dev6.dist-info/WHEEL
creating 'dist/stacksearch-1.2.1.dev6-py3-none-any.whl' and adding 'build/bdist.macosx-10.9-x86_64/wheel' to it
adding 'stacksearch-1.2.1.dev6.data/scripts/stacksearch'
adding 'stacksearch-1.2.1.dev6.dist-info/LICENSE'
adding 'stacksearch-1.2.1.dev6.dist-info/METADATA'
adding 'stacksearch-1.2.1.dev6.dist-info/WHEEL'
adding 'stacksearch-1.2.1.dev6.dist-info/top_level.txt'
adding 'stacksearch-1.2.1.dev6.dist-info/RECORD'
removing build/bdist.macosx-10.9-x86_64/wheel
(venv) RealName@theXliners-Mac stacksearch %
所以,为了模拟安装,我 运行 pip install -e .
(在我的虚拟环境中)在我的上层 stacksearch
文件夹中。
(venv) RealName@theXliners-Mac stacksearch % pip install -e .
Obtaining file:///Users/RealName/projects/stacksearch
Requirement already satisfied: requests in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (2.24.0)
Requirement already satisfied: bs4 in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (0.0.1)
Requirement already satisfied: blessings in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (1.7)
Requirement already satisfied: lxml in /Users/bryanhu/venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (4.5.2)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1
.2.1.dev6) (1.25.10)
Requirement already satisfied: certifi>=2017.4.17 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2020.6.20
)
Requirement already satisfied: idna<3,>=2.5 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/bryanhu/venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (3.0.4)
Requirement already satisfied: beautifulsoup4 in /Users/bryanhu/venv/lib/python3.8/site-packages (from bs4->stacksearch==1.2.1.dev6) (4.9.1)
Requirement already satisfied: six in /Users/bryanhu/venv/lib/python3.8/site-packages (from blessings->stacksearch==1.2.1.dev6) (1.15.0)
Requirement already satisfied: soupsieve>1.2 in /Users/bryanhu/venv/lib/python3.8/site-packages (from beautifulsoup4->bs4->stacksearch==1.2.1.dev6) (2.0
.1)
Installing collected packages: stacksearch
Attempting uninstall: stacksearch
Found existing installation: stacksearch 1.2.1.dev6
Uninstalling stacksearch-1.2.1.dev6:
Successfully uninstalled stacksearch-1.2.1.dev6
Running setup.py develop for stacksearch
Successfully installed stacksearch
(venv) RealName@theXliners-Mac stacksearch %
然后我运行stacksearch
(命令):
(venv) RealName@theXliners-Mac stacksearch % stacksearch
usage: StackSearch [-h] [-j] [-o [OUTPUT]] [-s] [--sites SITES [SITES ...]] [-v] [query [query ...]]
For searching Whosebug and getting results that you can use.
There are many other libraries/modules available that do the same
thing. The reason you should use this is because this returns results that you can
use. If ran from the command line, it'll return human readable results. If ran from
another python script, it'll return some parsable JSON. Assuming you are utilizing
this script's wonderful functions and objects.
positional arguments:
query The query to search.
optional arguments:
-h, --help show this help message and exit
-j, --json, --raw-data, -r, --raw
For outputting JSON data that you can use.
-o [OUTPUT], --output [OUTPUT]
The output file.
-s, --silent Don't print the progress.
--sites SITES [SITES ...]
The StackExchange sites to search.
-v, -V, --version Print the version number and exit.
Judge a man by his questions rather than by his answers" - Voltaire
(venv) RealName@theXliners-Mac stacksearch %
有效! (要查看文件中的内容,请查看 GitHub repo)
但遗憾的是,事实并非如此:它不适用于我从 testpypi 获得的那个。
(venv) RealName@theXliners-Mac ~ % pip install -i https://test.pypi.org/simple/ stacksearch==1.2.1.dev6; stacksearch
Looking in indexes: https://test.pypi.org/simple/
Collecting stacksearch==1.2.1.dev6
Downloading https://test-files.pythonhosted.org/packages/a4/09/5040ea9750192d64ccb634e022967793759592a47637731a845dbb2ab636/stacksearch-1.2.1.dev6-py3
-none-any.whl (4.4 kB)
Requirement already satisfied: bs4 in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (0.0.1)
Requirement already satisfied: blessings in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (1.7)
Requirement already satisfied: lxml in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (4.5.2)
Requirement already satisfied: requests in ./venv/lib/python3.8/site-packages (from stacksearch==1.2.1.dev6) (2.24.0)
Requirement already satisfied: beautifulsoup4 in ./venv/lib/python3.8/site-packages (from bs4->stacksearch==1.2.1.dev6) (4.9.1)
Requirement already satisfied: six in ./venv/lib/python3.8/site-packages (from blessings->stacksearch==1.2.1.dev6) (1.15.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (1
.25.10)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in ./venv/lib/python3.8/site-packages (from requests->stacksearch==1.2.1.dev6) (2.10)
Requirement already satisfied: soupsieve>1.2 in ./venv/lib/python3.8/site-packages (from beautifulsoup4->bs4->stacksearch==1.2.1.dev6) (2.0.1)
Installing collected packages: stacksearch
Successfully installed stacksearch-1.2.1.dev6
Traceback (most recent call last):
File "/Users/bryanhu/venv/bin/stacksearch", line 156, in <module>
main(sys.argv[1:])
File "/Users/bryanhu/venv/bin/stacksearch", line 25, in main
from stacksearch import __version__
ModuleNotFoundError: No module named 'stacksearch'
那我测试一下:
(venv) RealName@theXliners-Mac ~ % python
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import stacksearch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'stacksearch'
>>>
我的问题
为什么当我执行 pip install -e .
时,我可以安装软件包,但如果我从 PyPi 安装它,它只会安装二进制文件?
这可能是您问题的答案。将其发布为答案允许我使用我需要的 space 和格式。
基本问题是您没有在 dist 文件中包含 stacksearch
文件夹。
我发现的一种方法是从 pypi.test 下载您的 tar 球。您可以看到文件夹中的内容,并且只有脚本。另一种方法是查看 pip install -e .
命令的结果。你可以在这里看到它:
copying README.md -> stacksearch-1.2.1.dev6
copying setup.py -> stacksearch-1.2.1.dev6
copying scripts/stacksearch -> stacksearch-1.2.1.dev6/scripts
copying stacksearch.egg-info/PKG-INFO -> stacksearch-1.2.1.dev6/stacksearch.egg-info
它只是复制脚本文件夹
您可以 run commands directly from setup.py 通过 python -m setup.py <some command>
看看正在构建什么。
可能的解决方案
可能是 find_packages
没有找到您认为的所有内容。尝试将该函数导入解释器并 运行 它。这是我自己的存储库中的结果:
find_packages()
Out[9]:
['dicetables',
'tests',
'time_trials',
'dicetables.eventsbases',
'dicetables.factory',
'dicetables.tools',
'tests.eventsbases',
'tests.factory',
'tests.tools']
find_packages(include='dicetables')
Out[10]: []
find_packages(include=['dicetables'])
Out[11]: ['dicetables']
不一定是您所期望的。因此,尝试使用 find_packages
以及当您 pip install -e .
p.s。您没有在本地目录中发现任何问题,因为您的脚本可以从已经存在的文件夹中导入。如果你已经移动到不同的目录,它应该会失败。